package reader;

import grammer.objectMatcher.TokenMatcher;

/**
 * 
 * @author Minodor
 * 
 *         Builds The Scenario;
 */

public class ScenarioBuilder {

	private LineTokenizer lt;
	private TokenMatcher tm;

	/**
	 * Invoke to build a scenario from file
	 * 
	 * @return
	 */

	public ScenarioBuilder() {
	}

	public boolean build(String Scenario) {
		lt = new LineTokenizer();
		tm = new TokenMatcher();
		String lines[] = Scenario.split("\n");
		System.out.println(lines.length);
		if (lines.length > 0)
			for (int lineNumber = 0; lineNumber < lines.length; lineNumber++) {
				String nextLine = lines[lineNumber];
				if (nextLine.length() > 1) {
					if (lt.split(nextLine)) {
						if (tm.Handle(lt.getNextLineTokens(), lineNumber))
							;
						else
							return false;
					}
				} else
					return false;
			}
		else
			return false;
		return true;
	}
}
